clear all

#delimit ;
*  PSID DATA CENTER *****************************************************
   JOBID            : 317755                            
   DATA_DOMAIN      : IND                               
   USER_WHERE       : NULL                              
   FILE_TYPE        : All Individuals Data              
   OUTPUT_DATA_TYPE : ASCII                             
   STATEMENTS       : do                                
   CODEBOOK_TYPE    : NULL                              
   N_OF_VARIABLES   : 254                               
   N_OF_OBSERVATIONS: 82573                             
   MAX_REC_LENGTH   : 785                               
   DATE & TIME      : March 15, 2023 @ 16:32:19
*************************************************************************
;

infix
      ER30000              1 - 1           ER30001              2 - 5           ER30002              6 - 8     
      V1                   9 - 9      long V81                 10 - 14          ER30003             15 - 15    
      V441                16 - 16     long V529                17 - 21          ER30020             22 - 25    
      ER30021             26 - 27          ER30022             28 - 28          V1101               29 - 29    
 long V1514               30 - 34          ER30043             35 - 38          ER30044             39 - 40    
      ER30045             41 - 41          V1801               42 - 42     long V2226               43 - 47    
      ER30067             48 - 51          ER30068             52 - 53          ER30069             54 - 54    
      V2401               55 - 55     long V2852               56 - 60          ER30091             61 - 64    
      ER30092             65 - 66          ER30093             67 - 67          V3001               68 - 68    
 long V3256               69 - 73          ER30117             74 - 77          ER30118             78 - 79    
      ER30119             80 - 80          V3401               81 - 81     long V3676               82 - 86    
      ER30138             87 - 90          ER30139             91 - 92          ER30140             93 - 93    
      V3801               94 - 94     long V4154               95 - 99          ER30160            100 - 103   
      ER30161            104 - 105         ER30162            106 - 106         V4301              107 - 107   
 long V5029              108 - 112         ER30188            113 - 116         ER30189            117 - 118   
      ER30190            119 - 119         V5201              120 - 120    long V5626              121 - 125   
      ER30217            126 - 129         ER30218            130 - 131         ER30219            132 - 132   
      V5701              133 - 133    long V6173              134 - 138         ER30246            139 - 142   
      ER30247            143 - 144         ER30248            145 - 145         V6301              146 - 146   
 long V6766              147 - 151         ER30283            152 - 155         ER30284            156 - 157   
      ER30285            158 - 158         V6901              159 - 159    long V7412              160 - 165   
      ER30313            166 - 169         ER30314            170 - 171         ER30315            172 - 172   
      V7501              173 - 173    long V8065              174 - 180         ER30343            181 - 184   
      ER30344            185 - 186         ER30345            187 - 187         V8201              188 - 188   
 long V8689              189 - 195         ER30373            196 - 199         ER30374            200 - 201   
      ER30375            202 - 202         V8801              203 - 203    long V9375              204 - 210   
      ER30399            211 - 214         ER30400            215 - 216         ER30401            217 - 218   
      V10001             219 - 219    long V11022             220 - 225         ER30429            226 - 229   
      ER30430            230 - 231         ER30431            232 - 233         V11101             234 - 234   
 long V12371             235 - 240         ER30463            241 - 244         ER30464            245 - 246   
      ER30465            247 - 248         V12501             249 - 249    long V13623             250 - 256   
      ER30498            257 - 260         ER30499            261 - 262         ER30500            263 - 264   
      V13701             265 - 265    long V14670             266 - 272         ER30535            273 - 276   
      ER30536            277 - 278         ER30537            279 - 280         V14801             281 - 281   
 long V16144             282 - 288         ER30570            289 - 292         ER30571            293 - 294   
      ER30572            295 - 296         V16301             297 - 297    long V17533             298 - 304   
      ER30606            305 - 308         ER30607            309 - 310         ER30608            311 - 312   
      V17701             313 - 313    long V18875             314 - 320         ER30642            321 - 325   
      ER30643            326 - 327         ER30644            328 - 329         V19001             330 - 330   
 long V20175             331 - 337         ER30689            338 - 341         ER30690            342 - 343   
      ER30691            344 - 345         V20301             346 - 346    long V21481             347 - 353   
      ER30733            354 - 357         ER30734            358 - 359         ER30735            360 - 361   
      V21601             362 - 362    long V23322             363 - 369         ER30806            370 - 374   
      ER30807            375 - 376         ER30808            377 - 378         ER2001             379 - 379   
 long ER4153             380 - 386         ER33101            387 - 391         ER33102            392 - 393   
      ER33103            394 - 395         ER5001             396 - 396    long ER6993             397 - 403   
      ER33201            404 - 408         ER33202            409 - 410         ER33203            411 - 412   
      ER7001             413 - 413    long ER9244             414 - 420         ER33301            421 - 424   
      ER33302            425 - 426         ER33303            427 - 428         ER10001            429 - 429   
 long ER12079            430 - 438         ER12152            439 - 441         ER12154            442 - 444   
      ER12161            445 - 447         ER12163            448 - 450         ER33401            451 - 455   
      ER33402            456 - 457         ER33403            458 - 459         ER13001            460 - 460   
      ER15813            461 - 463         ER15822            464 - 466         ER15898            467 - 469   
      ER15907            470 - 472    long ER16462            473 - 479         ER33501            480 - 484   
      ER33502            485 - 486         ER33503            487 - 488         ER17001            489 - 489   
      ER19874            490 - 492         ER19883            493 - 495         ER19959            496 - 498   
      ER19968            499 - 501    long ER20456            502 - 508         ER33601            509 - 512   
      ER33602            513 - 514         ER33603            515 - 516         ER21001            517 - 517   
      ER23311            518 - 520         ER23320            521 - 523         ER23396            524 - 526   
      ER23405            527 - 529    long ER24099            530 - 536         ER33701            537 - 541   
      ER33702            542 - 543         ER33703            544 - 545         ER25001            546 - 546   
      ER27272            547 - 549         ER27282            550 - 552         ER27361            553 - 555   
      ER27371            556 - 558    long ER28037            559 - 565         ER33801            566 - 570   
      ER33802            571 - 572         ER33803            573 - 574         ER36001            575 - 575   
      ER40447            576 - 578         ER40457            579 - 581         ER40536            582 - 584   
      ER40546            585 - 587    long ER41027            588 - 594         ER33901            595 - 599   
      ER33902            600 - 601         ER33903            602 - 603         ER42001            604 - 604   
      ER46419            605 - 607         ER46429            608 - 610         ER46513            611 - 613   
      ER46523            614 - 616    long ER46935            617 - 623         ER34001            624 - 628   
      ER34002            629 - 630         ER34003            631 - 632         ER47301            633 - 633   
      ER51780            634 - 636         ER51790            637 - 639         ER51874            640 - 642   
      ER51884            643 - 645    long ER52343            646 - 652         ER34101            653 - 657   
      ER34102            658 - 659         ER34103            660 - 661         ER53001            662 - 662   
      ER57517            663 - 665         ER57527            666 - 668         ER57627            669 - 671   
      ER57637            672 - 674    long ER58152            675 - 681         ER34201            682 - 686   
      ER34202            687 - 688         ER34203            689 - 690         ER60001            691 - 691   
      ER64639            692 - 694         ER64649            695 - 697         ER64778            698 - 700   
      ER64788            701 - 703    long ER65349            704 - 710         ER34301            711 - 715   
      ER34302            716 - 717         ER34303            718 - 719         ER66001            720 - 720   
      ER70712            721 - 724         ER70722            725 - 728         ER70850            729 - 732   
      ER70860            733 - 736    long ER71426            737 - 743         ER34501            744 - 748   
      ER34502            749 - 750         ER34503            751 - 752         ER72001            753 - 753   
      ER76720            754 - 757         ER76730            758 - 761         ER76865            762 - 765   
      ER76875            766 - 769    long ER77448            770 - 776         ER34701            777 - 781   
      ER34702            782 - 783         ER34703            784 - 785   
using ./RawData/parentalocc.txt, clear 
;
label variable ER30000         "RELEASE NUMBER"                           ;
label variable ER30001         "1968 INTERVIEW NUMBER"                    ;
label variable ER30002         "PERSON NUMBER                         68" ;
label variable V1              "RELEASE NUMBER"                           ;
label variable V81             "FAM MONEY INC"                            ;
label variable ER30003         "RELATIONSHIP TO HEAD                  68" ;
label variable V441            "RELEASE NUMBER"                           ;
label variable V529            "TOTAL FU $  INC"                          ;
label variable ER30020         "1969 INTERVIEW NUMBER"                    ;
label variable ER30021         "SEQUENCE NUMBER                       69" ;
label variable ER30022         "RELATIONSHIP TO HEAD                  69" ;
label variable V1101           "RELEASE NUMBER"                           ;
label variable V1514           "TOT FU MON INC OV414"                     ;
label variable ER30043         "1970 INTERVIEW NUMBER"                    ;
label variable ER30044         "SEQUENCE NUMBER                       70" ;
label variable ER30045         "RELATIONSHIP TO HEAD                  70" ;
label variable V1801           "RELEASE NUMBER"                           ;
label variable V2226           "TOT FU MON INC"                           ;
label variable ER30067         "1971 INTERVIEW NUMBER"                    ;
label variable ER30068         "SEQUENCE NUMBER                       71" ;
label variable ER30069         "RELATIONSHIP TO HEAD                  71" ;
label variable V2401           "RELEASE NUMBER"                           ;
label variable V2852           "TOT FU MON INC"                           ;
label variable ER30091         "1972 INTERVIEW NUMBER"                    ;
label variable ER30092         "SEQUENCE NUMBER                       72" ;
label variable ER30093         "RELATIONSHIP TO HEAD                  72" ;
label variable V3001           "RELEASE NUMBER"                           ;
label variable V3256           "TOT FU MON INC"                           ;
label variable ER30117         "1973 INTERVIEW NUMBER"                    ;
label variable ER30118         "SEQUENCE NUMBER                       73" ;
label variable ER30119         "RELATIONSHIP TO HEAD                  73" ;
label variable V3401           "RELEASE NUMBER"                           ;
label variable V3676           "TOT FU MON INC"                           ;
label variable ER30138         "1974 INTERVIEW NUMBER"                    ;
label variable ER30139         "SEQUENCE NUMBER                       74" ;
label variable ER30140         "RELATIONSHIP TO HEAD                  74" ;
label variable V3801           "RELEASE NUMBER"                           ;
label variable V4154           "TOT FU MON INC"                           ;
label variable ER30160         "1975 INTERVIEW NUMBER"                    ;
label variable ER30161         "SEQUENCE NUMBER                       75" ;
label variable ER30162         "RELATIONSHIP TO HEAD                  75" ;
label variable V4301           "RELEASE NUMBER"                           ;
label variable V5029           "TOT FU MONEY INC"                         ;
label variable ER30188         "1976 INTERVIEW NUMBER"                    ;
label variable ER30189         "SEQUENCE NUMBER                       76" ;
label variable ER30190         "RELATIONSHIP TO HEAD                  76" ;
label variable V5201           "RELEASE NUMBER"                           ;
label variable V5626           "TOT 1976 FAM MONEY INCOM"                 ;
label variable ER30217         "1977 INTERVIEW NUMBER"                    ;
label variable ER30218         "SEQUENCE NUMBER                       77" ;
label variable ER30219         "RELATIONSHIP TO HEAD                  77" ;
label variable V5701           "RELEASE NUMBER"                           ;
label variable V6173           "TOT 1977 FAM $  INC"                      ;
label variable ER30246         "1978 INTERVIEW NUMBER"                    ;
label variable ER30247         "SEQUENCE NUMBER                       78" ;
label variable ER30248         "RELATIONSHIP TO HEAD                  78" ;
label variable V6301           "RELEASE NUMBER"                           ;
label variable V6766           "TOT 1978 FAM $  INC"                      ;
label variable ER30283         "1979 INTERVIEW NUMBER"                    ;
label variable ER30284         "SEQUENCE NUMBER                       79" ;
label variable ER30285         "RELATIONSHIP TO HEAD                  79" ;
label variable V6901           "RELEASE NUMBER"                           ;
label variable V7412           "TOT FAM $ Y 79"                           ;
label variable ER30313         "1980 INTERVIEW NUMBER"                    ;
label variable ER30314         "SEQUENCE NUMBER                       80" ;
label variable ER30315         "RELATIONSHIP TO HEAD                  80" ;
label variable V7501           "RELEASE NUMBER"                           ;
label variable V8065           "TOT FAM $ $  Y 80"                        ;
label variable ER30343         "1981 INTERVIEW NUMBER"                    ;
label variable ER30344         "SEQUENCE NUMBER                       81" ;
label variable ER30345         "RELATIONSHIP TO HEAD                  81" ;
label variable V8201           "RELEASE NUMBER"                           ;
label variable V8689           "TOT FAM $ $  Y 81"                        ;
label variable ER30373         "1982 INTERVIEW NUMBER"                    ;
label variable ER30374         "SEQUENCE NUMBER                       82" ;
label variable ER30375         "RELATIONSHIP TO HEAD                  82" ;
label variable V8801           "RELEASE NUMBER"                           ;
label variable V9375           "TOT FAM MONEY Y 82"                       ;
label variable ER30399         "1983 INTERVIEW NUMBER"                    ;
label variable ER30400         "SEQUENCE NUMBER                       83" ;
label variable ER30401         "RELATIONSHIP TO HEAD                  83" ;
label variable V10001          "RELEASE NUMBER"                           ;
label variable V11022          "TOT FAM MONEY Y 83"                       ;
label variable ER30429         "1984 INTERVIEW NUMBER"                    ;
label variable ER30430         "SEQUENCE NUMBER                       84" ;
label variable ER30431         "RELATIONSHIP TO HEAD                  84" ;
label variable V11101          "RELEASE NUMBER"                           ;
label variable V12371          "TOT FAM MONEY Y 84"                       ;
label variable ER30463         "1985 INTERVIEW NUMBER"                    ;
label variable ER30464         "SEQUENCE NUMBER                       85" ;
label variable ER30465         "RELATIONSHIP TO HEAD                  85" ;
label variable V12501          "RELEASE NUMBER"                           ;
label variable V13623          "TOT FAM MONEY Y 85"                       ;
label variable ER30498         "1986 INTERVIEW NUMBER"                    ;
label variable ER30499         "SEQUENCE NUMBER                       86" ;
label variable ER30500         "RELATIONSHIP TO HEAD                  86" ;
label variable V13701          "RELEASE NUMBER"                           ;
label variable V14670          "TOT FAM MONEY Y 86"                       ;
label variable ER30535         "1987 INTERVIEW NUMBER"                    ;
label variable ER30536         "SEQUENCE NUMBER                       87" ;
label variable ER30537         "RELATIONSHIP TO HEAD                  87" ;
label variable V14801          "RELEASE NUMBER"                           ;
label variable V16144          "TOT FAM MONEY Y 87"                       ;
label variable ER30570         "1988 INTERVIEW NUMBER"                    ;
label variable ER30571         "SEQUENCE NUMBER                       88" ;
label variable ER30572         "RELATION TO HEAD                      88" ;
label variable V16301          "RELEASE NUMBER"                           ;
label variable V17533          "TOT FAM MONEY Y 88"                       ;
label variable ER30606         "1989 INTERVIEW NUMBER"                    ;
label variable ER30607         "SEQUENCE NUMBER                       89" ;
label variable ER30608         "RELATION TO HEAD                      89" ;
label variable V17701          "RELEASE NUMBER"                           ;
label variable V18875          "TOT FAM MONEY Y 89"                       ;
label variable ER30642         "1990 INTERVIEW NUMBER"                    ;
label variable ER30643         "SEQUENCE NUMBER                       90" ;
label variable ER30644         "RELATION TO HEAD                      90" ;
label variable V19001          "RELEASE NUMBER"                           ;
label variable V20175          "TOT FAM MONEY Y 90"                       ;
label variable ER30689         "1991 INTERVIEW NUMBER"                    ;
label variable ER30690         "SEQUENCE NUMBER                       91" ;
label variable ER30691         "RELATION TO HEAD                      91" ;
label variable V20301          "RELEASE NUMBER"                           ;
label variable V21481          "TOT FAM MONEY Y 91"                       ;
label variable ER30733         "1992 INTERVIEW NUMBER"                    ;
label variable ER30734         "SEQUENCE NUMBER                       92" ;
label variable ER30735         "RELATION TO HEAD                      92" ;
label variable V21601          "RELEASE NUMBER"                           ;
label variable V23322          "TOTAL 1992 FAMILY MONEY INCOME"           ;
label variable ER30806         "1993 INTERVIEW NUMBER"                    ;
label variable ER30807         "SEQUENCE NUMBER                       93" ;
label variable ER30808         "RELATION TO HEAD                      93" ;
label variable ER2001          "RELEASE NUMBER"                           ;
label variable ER4153          "TOTAL FAMILY INCOME-1993"                 ;
label variable ER33101         "1994 INTERVIEW NUMBER"                    ;
label variable ER33102         "SEQUENCE NUMBER                       94" ;
label variable ER33103         "RELATION TO HEAD                      94" ;
label variable ER5001          "RELEASE NUMBER"                           ;
label variable ER6993          "TOTAL FAMILY INCOME-1994"                 ;
label variable ER33201         "1995 INTERVIEW NUMBER"                    ;
label variable ER33202         "SEQUENCE NUMBER                       95" ;
label variable ER33203         "RELATION TO HEAD                      95" ;
label variable ER7001          "RELEASE NUMBER"                           ;
label variable ER9244          "TOTAL FAMILY INCOME-1995"                 ;
label variable ER33301         "1996 INTERVIEW NUMBER"                    ;
label variable ER33302         "SEQUENCE NUMBER                       96" ;
label variable ER33303         "RELATION TO HEAD                      96" ;
label variable ER10001         "RELEASE NUMBER"                           ;
label variable ER12079         "TOTAL FAMILY INCOME"                      ;
label variable ER12152         "K10-10A OCCUPATION OF FATHER"             ;
label variable ER12154         "K20-20A OCCUPATION OF MOTHER"             ;
label variable ER12161         "L10-10A OCCUPATION OF FATHER"             ;
label variable ER12163         "L20-20A OCCUPATION OF MOTHER"             ;
label variable ER33401         "1997 INTERVIEW NUMBER"                    ;
label variable ER33402         "SEQUENCE NUMBER                       97" ;
label variable ER33403         "RELATION TO HEAD                      97" ;
label variable ER13001         "RELEASE NUMBER"                           ;
label variable ER15813         "K10-10A OCCUPATION OF FATHER"             ;
label variable ER15822         "K20-20A OCCUPATION OF MOTHER"             ;
label variable ER15898         "L10-10A OCCUPATION OF FATHER"             ;
label variable ER15907         "L20-20A OCCUPATION OF MOTHER"             ;
label variable ER16462         "TOTAL FAMILY INCOME"                      ;
label variable ER33501         "1999 INTERVIEW NUMBER"                    ;
label variable ER33502         "SEQUENCE NUMBER                       99" ;
label variable ER33503         "RELATION TO HEAD                      99" ;
label variable ER17001         "RELEASE NUMBER"                           ;
label variable ER19874         "K10-10A OCCUPATION OF FATHER"             ;
label variable ER19883         "K20-20A OCCUPATION OF MOTHER"             ;
label variable ER19959         "L10-10A OCCUPATION OF FATHER"             ;
label variable ER19968         "L20-20A OCCUPATION OF MOTHER"             ;
label variable ER20456         "TOTAL FAMILY INCOME-2000"                 ;
label variable ER33601         "2001 INTERVIEW NUMBER"                    ;
label variable ER33602         "SEQUENCE NUMBER                       01" ;
label variable ER33603         "RELATION TO HEAD                      01" ;
label variable ER21001         "RELEASE NUMBER"                           ;
label variable ER23311         "K10-10A OCCUPATION OF FATHER"             ;
label variable ER23320         "K20-20A OCCUPATION OF MOTHER"             ;
label variable ER23396         "L10-10A OCCUPATION OF FATHER"             ;
label variable ER23405         "L20-20A OCCUPATION OF MOTHER"             ;
label variable ER24099         "TOTAL FAMILY INCOME LAST YEAR"            ;
label variable ER33701         "2003 INTERVIEW NUMBER"                    ;
label variable ER33702         "SEQUENCE NUMBER                       03" ;
label variable ER33703         "RELATION TO HEAD                      03" ;
label variable ER25001         "RELEASE NUMBER"                           ;
label variable ER27272         "K10-10A OCCUPATION OF FATHER-WF"          ;
label variable ER27282         "K20-20A OCCUPATION OF MOTHER-WF"          ;
label variable ER27361         "L10-10A OCCUPATION OF FATHER-HD"          ;
label variable ER27371         "L20-20A OCCUPATION OF MOTHER-HD"          ;
label variable ER28037         "TOTAL FAMILY INCOME-2004"                 ;
label variable ER33801         "2005 INTERVIEW NUMBER"                    ;
label variable ER33802         "SEQUENCE NUMBER                       05" ;
label variable ER33803         "RELATION TO HEAD                      05" ;
label variable ER36001         "RELEASE NUMBER"                           ;
label variable ER40447         "K10-10A OCCUPATION OF FATHER-WF"          ;
label variable ER40457         "K20-20A OCCUPATION OF MOTHER-WF"          ;
label variable ER40536         "L10-10A OCCUPATION OF FATHER-HD"          ;
label variable ER40546         "L20-20A OCCUPATION OF MOTHER-HD"          ;
label variable ER41027         "TOTAL FAMILY INCOME-2006"                 ;
label variable ER33901         "2007 INTERVIEW NUMBER"                    ;
label variable ER33902         "SEQUENCE NUMBER                       07" ;
label variable ER33903         "RELATION TO HEAD                      07" ;
label variable ER42001         "RELEASE NUMBER"                           ;
label variable ER46419         "K10-10A OCCUPATION OF FATHER-WF"          ;
label variable ER46429         "K20-20A OCCUPATION OF MOTHER-WF"          ;
label variable ER46513         "L10-10A OCCUPATION OF FATHER-HD"          ;
label variable ER46523         "L20-20A OCCUPATION OF MOTHER-HD"          ;
label variable ER46935         "TOTAL FAMILY INCOME-2008"                 ;
label variable ER34001         "2009 INTERVIEW NUMBER"                    ;
label variable ER34002         "SEQUENCE NUMBER                       09" ;
label variable ER34003         "RELATION TO HEAD                      09" ;
label variable ER47301         "RELEASE NUMBER"                           ;
label variable ER51780         "K10 OCCUPATION OF FATHER-WF"              ;
label variable ER51790         "K20 OCCUPATION OF MOTHER-WF"              ;
label variable ER51874         "L10 OCCUPATION OF FATHER-HD"              ;
label variable ER51884         "L20 OCCUPATION OF MOTHER-HD"              ;
label variable ER52343         "TOTAL FAMILY INCOME-2010"                 ;
label variable ER34101         "2011 INTERVIEW NUMBER"                    ;
label variable ER34102         "SEQUENCE NUMBER                       11" ;
label variable ER34103         "RELATION TO HEAD                      11" ;
label variable ER53001         "RELEASE NUMBER"                           ;
label variable ER57517         "K10 OCCUPATION OF FATHER-WF"              ;
label variable ER57527         "K20 OCCUPATION OF MOTHER-WF"              ;
label variable ER57627         "L10 OCCUPATION OF FATHER-HD"              ;
label variable ER57637         "L20 OCCUPATION OF MOTHER-HD"              ;
label variable ER58152         "TOTAL FAMILY INCOME-2012"                 ;
label variable ER34201         "2013 INTERVIEW NUMBER"                    ;
label variable ER34202         "SEQUENCE NUMBER                       13" ;
label variable ER34203         "RELATION TO HEAD                      13" ;
label variable ER60001         "RELEASE NUMBER"                           ;
label variable ER64639         "K10 OCCUPATION OF FATHER-SP"              ;
label variable ER64649         "K20 OCCUPATION OF MOTHER-SP"              ;
label variable ER64778         "L10 OCCUPATION OF FATHER-HD"              ;
label variable ER64788         "L20 OCCUPATION OF MOTHER-HD"              ;
label variable ER65349         "TOTAL FAMILY INCOME-2014"                 ;
label variable ER34301         "2015 INTERVIEW NUMBER"                    ;
label variable ER34302         "SEQUENCE NUMBER                       15" ;
label variable ER34303         "RELATION TO HEAD                      15" ;
label variable ER66001         "RELEASE NUMBER"                           ;
label variable ER70712         "K10 OCCUPATION OF FATHER-SP"              ;
label variable ER70722         "K20 OCCUPATION OF MOTHER-SP"              ;
label variable ER70850         "L10 OCCUPATION OF FATHER-RP"              ;
label variable ER70860         "L20 OCCUPATION OF MOTHER-RP"              ;
label variable ER71426         "TOTAL FAMILY INCOME-2016"                 ;
label variable ER34501         "2017 INTERVIEW NUMBER"                    ;
label variable ER34502         "SEQUENCE NUMBER                       17" ;
label variable ER34503         "RELATION TO REFERENCE PERSON          17" ;
label variable ER72001         "RELEASE NUMBER"                           ;
label variable ER76720         "K10 OCCUPATION OF FATHER-SP"              ;
label variable ER76730         "K20 OCCUPATION OF MOTHER-SP"              ;
label variable ER76865         "L10 OCCUPATION OF FATHER-RP"              ;
label variable ER76875         "L20 OCCUPATION OF MOTHER-RP"              ;
label variable ER77448         "TOTAL FAMILY INCOME-2018"                 ;
label variable ER34701         "2019 INTERVIEW NUMBER"                    ;
label variable ER34702         "SEQUENCE NUMBER                       19" ;
label variable ER34703         "RELATION TO REFERENCE PERSON        19" ;

do ./RawData/parentalocc_formats.do ;
#delimit cr

drop V1-ER10001 //don't need variables prior to 1997

//Keep fam inc for 2017 and 2019 (indfam do-file has totfaminc in all other years.)
   lookfor tot
   local totvars "`r(varlist)'"
   di "`r(varlist)'"

   local newmoney "ER71426 ER77448"

   local moneydrop : list totvars - newmoney 
   di "`moneydrop'"

//drop all years of family income besides 2017 and 2019
     foreach v of local moneydrop {
          drop `v'
     }

//RENAME TOTAL FAMILY INCOME VARS
   ren ER71426 totfaminc2017
   ren ER77448 totfaminc2019

//RENAME PARENTAL RETRO OCC VARS, BY YEAR. NEED ALL YEARS BECAUSE AM ADDING NON-HEADS
   ren ER12152 father_occ_SP_1997
   ren ER12154 mother_occ_SP_1997
   ren ER12161 father_occ_HD_1997
   ren ER12163 mother_occ_HD_1997

   ren ER15813 father_occ_SP_1999
   ren ER15822 mother_occ_SP_1999
   ren ER15898 father_occ_HD_1999
   ren ER15907 mother_occ_HD_1999
   
   ren ER19874 father_occ_SP_2001
   ren ER19883 mother_occ_SP_2001
   ren ER19959 father_occ_HD_2001
   ren ER19968 mother_occ_HD_2001
   
   ren ER23311 father_occ_SP_2003
   ren ER23320 mother_occ_SP_2003
   ren ER23396 father_occ_HD_2003
   ren ER23405 mother_occ_HD_2003
  
   ren ER27272 father_occ_SP_2005
   ren ER27282 mother_occ_SP_2005
   ren ER27361 father_occ_HD_2005
   ren ER27371 mother_occ_HD_2005
   
   ren ER40447 father_occ_SP_2007
   ren ER40457 mother_occ_SP_2007
   ren ER40536 father_occ_HD_2007
   ren ER40546 mother_occ_HD_2007
   
   ren ER46419 father_occ_SP_2009
   ren ER46429 mother_occ_SP_2009
   ren ER46513 father_occ_HD_2009
   ren ER46523 mother_occ_HD_2009
  
   ren ER51780 father_occ_SP_2011
   ren ER51790 mother_occ_SP_2011
   ren ER51874 father_occ_HD_2011
   ren ER51884 mother_occ_HD_2011
  
   ren ER57517 father_occ_SP_2013
   ren ER57527 mother_occ_SP_2013
   ren ER57627 father_occ_HD_2013
   ren ER57637 mother_occ_HD_2013
  
   ren ER64639 father_occ_SP_2015
   ren ER64649 mother_occ_SP_2015
   ren ER64778 father_occ_HD_2015
   ren ER64788 mother_occ_HD_2015
  
   ren ER70712 father_occ_SP_2017
   ren ER70722 mother_occ_SP_2017
   ren ER70850 father_occ_HD_2017
   ren ER70860 mother_occ_HD_2017
  
   ren ER76720 father_occ_SP_2019
   ren ER76730 mother_occ_SP_2019
   ren ER76865 father_occ_HD_2019
   ren ER76875 mother_occ_HD_2019

//Keep sequence number and relation to head for 2017 and 2019 (indfam do-file has these vars in all other years.) 
   lookfor seq
   local seqvars "`r(varlist)'"
   di "`r(varlist)'"

   local newseq "ER34502 ER34702"

   local seqdrop : list seqvars - newseq 
   di "`seqdrop'"

//drop all years of sequence var besides 2017 and 2019
     foreach v of local seqdrop {
          drop `v'
     }

   lookfor relat
   local relvars "`r(varlist)'"
   di "`r(varlist)'"

   local newrel "ER34503 ER34703"

   local reldrop : list relvars - newrel
   di "`reldrop'"

//drop all years of relation to head var besides 2017 and 2019
     foreach v of local reldrop {
          drop `v'
     }

//RENAME SEQUENCE NUMBER AND RELATION TO HEAD, FOR 2017 AND 2019 (1997-2015 already relabelled in PSID_raw_cleaner)
   ren ER34502 sequencenumber2017
   ren ER34503 relate2017

   ren ER34702 sequencenumber2019
   ren ER34703 relate2019

//DROP OTHER UNNECESSARY VARIABLES
   lookfor release
   local release "`r(varlist)'"

   foreach v of local release {
      drop `v'
   }

   lookfor inter //interview year
   local intervars "`r(varlist)'"

   local newinter "ER30001 ER34501 ER34701"
   local interdrop: list intervars - newinter
   di "`interdrop'"

   foreach v of local interdrop {
       drop `v'
   }

   ren ER34501 intnumber2017
   ren ER34701 intnumber2019

// CREATE SON_ID, KEEP PERTINENT VARS, SAVE
   ren ER30001 famid
   ren ER30002 personnumber

   gen son_id = famid*1000 + personnumber
   label var son_id "Child 1968 ID"
   duplicates report son_id //no dups
         
   sort son_id 
   compress
   save ./RawData/parentalocc, replace



